/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */

package com.epsi.bowling.data.dao;

import com.epsi.bowling.core.bo.Reservation;
import com.epsi.bowling.data.utils.HibernateFactory;
import org.hibernate.Criteria;
import org.hibernate.Query;
import org.hibernate.Session;
import org.hibernate.criterion.Restrictions;

/**
 *
 * @author juju
 */
public class ReservationDAO extends AbstractData {
    private String table = "reservation";
    
    public ReservationDAO() {
        super(Reservation.class.getName());
    }
    
    public Reservation findByDateAndNom(String date, String nom) {
        session = (Session) HibernateFactory.getSessionFactory();
        Query q = session.createQuery("from " + this.table + " WHERE date='" +date + "' AND nom='" + nom + "'");
        return (Reservation)q.uniqueResult();
    }
}
